
$(function () {
    $("#list").datagrid({
        method: "post",
        url: getRootPath() + "/mtManage/assets/list_applyRecord",
        fit: true,
        border: true,
        pageNumber: 1,
        pageSize: 20,
        pageList: [10, 20, 30, 50, 100],
        columns: [[
            {field:'ck',checkbox:true},
            {field: "apply_id", title: "apply_id", width: 30,hidden:true},
            {field: "erp_no", title: "ERP", width: 150,
                formatter(value)
                {
                    if (value=="")
                    {return "通用";}
                    else
                    {return value;}
                }
            },
            {field: "apply_dept", title: "申请部门", width: 60},
            {field: "apply_man", title: "申请人", width: 60},
            {field: "type_dtl_no", title: "物料编码", width: 80},
            {field: "type_dtl_name", title: "物料名称", width: 120},
            {field: "sizes", title: "规格", width: 120},
            {field: "apply_num", title: "申请数目", width: 60},
            {field: "unit", title: "单位", width: 30,formatter:columShow},
            {field: "remark", title: "备注", width: 150},
            {field: "apply_time", title: "申请时间", width: 160},
            {field: "state", title: "状态", width: 50},
            {field: "refusereason", title: "拒绝原因", width: 100},
            {field: "refusereason_user", title: "拒绝人", width: 60},
            {field: "refusereason_time", title: "拒绝时间", width: 160},
        ]],
        onLoadSuccess: function (data) {
            $('.button-delete').linkbutton({});
            $('.button-edit').linkbutton({});
        },
        pagination: true,
        striped: true,
        singleSelect:true,
        //工具条
        toolbar: "#toolbar",
    });

});

//单元格扩展悬浮显示功能
var columShow = function colum_Show(value,row,index){
    return '<span title='+value+'>'+value+'</span>';
}

// 记录查询
function queryRecord() {
    $("#list").datagrid('load', {
        type_dtl_no:$("#type_dtl_no").val(),
        type_dtl_name:$("#type_dtl_name").val(),
        type_dtl_spec:$("#type_dtl_spec").val(),
        apply_man:$("#apply_man").val(),
        }
    );
}